# def print_hi(name):
#     # 在下面的代码行中使用断点来调试脚本。
#     print(f'Hi, {name}')  # 按 Ctrl+F8 切换断点。
#
#
# # 按装订区域中的绿色按钮以运行脚本。
# if __name__ == '__main__':
#     print_hi('dusk_林')
# # 这是一个示例 Python 脚本。
#
# # 按 Shift+F10 执行或将其替换为您的代码。
# # 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。
#
# print("hello!")# 注释测试行
# """
# 多行注释测试行
# 测试行2
# """
# 666
# 13.14
# "dusk_林"
# age = 18 # 变量测试行
#
# print(666)# int
# print(13.14)# float
# print("dusk_林")# string,打印时应添加引号“”
# print("年龄:",age)# 变量输出行
# age +=2
# print("两年后",age)# 运算测试行
#
# #查看数据类型
# # 方法1：print(type(被查看数据名))直接输出类型信息
# print(type(age))# 查看数据类型
# # 方法2:使用变量存储type()语句的结构
# string_type = type("dusk_林")
# int_type = type(13)
# float_type = type(3.14)
# print(string_type)
# print(int_type)
# print(float_type)
# # 方法3：使用type()语句，插卡变量中存储的数据类型信息
# name = "dusk"
# name_type = type(name)
# print(name_type)
#
# # 数据类型转换
# a = float(11)
# b = int(11.345)
# c = str(11)
# print(a,b,c,type(a),type(b),type(c))
#
# # 练习
# icecream = 10
# cora = 5
# money = 50
# print(f'当前钱包余额：{money}')
# print(f"购买了冰淇淋，花费：{icecream}")
# print(f"购买了可乐，花费：{cora}")
# print(f"最终钱包剩余：{money-icecream-cora}")
#
# print("9/2=",9/2) # 除法运算测试
# print("9%2=",9%2)# 取余运算测试
# num=5
# num //=2
# print("num //=2:",num) # 取余运算测试
#
#
# # 单引号字符串定义
# name = 'dusk_lin'
# print(type(name))
# # 双引号字符串定义
# name = "dusk_lin"
# print(type(name))
# # 三引号字符串定义
# name = """\'dusk_lin\"""" # 转移字符测试
# print(type(name))
# print(name)
#
# print("dusk_"+name+"_lin") # 字符串拼接测试，不可拼接非字符串类型
#
#
# # 字符串格式化测试
# message = "名字是%s" % name
# print(message)
# # 多个变量与字符串拼接
# message = "名字是%s,年龄是%d" % (name,age)
# print(message)
#
#
# # 字符串快速格式化测试
# print(f"用户名为{name},年龄为{age}")
#
#
# # 对表达式进行格式化测试
# print("1*1的结果是：%d"%(1*1))
# print(f"1*2的结果式：{1*2}")
# print("字符串在python中的类型名式%s"%(type('字符串')))
# from itertools import count
# from multiprocessing.connection import answer_challenge


# # 字符串格式化练习
# name = '传智播客'
# stock_price = 19.99
# stock_code = '003032'
# stock_price_daily_growth_factor = 1.2
# growth_days = 7
# finally_stock_price = stock_price * stock_price_daily_growth_factor ** growth_days
# print(f"公司：{name}，股票代码：{stock_code}，挡墙股价：{stock_price}")
# print("每日增长系数是：%.1f，经过%d天的增长后，股价达到了：%.2f"%(stock_price_daily_growth_factor,growth_days,finally_stock_price))
#
#
# # 输出语句测试
# print("请告诉我你是谁")
# name = input(”请告诉我你是谁“)
# print('好的，你是：%s'%name)
# 输入数字类型
# num = input('请告诉我你的编号')
# print("你的编号类型为",type(num))# 输入的数据类型固定为str
# num = int(input('请告诉我你的编号'))
# print("你的编号类型为",type(num))# 但可以手动转换为其他类型


# # 变量输入练习
# user_name = input("Enter your name: ")
# user_type = input("Enter your type: ")
# print(f'您好：{user_name},您是尊贵的：{user_type} 用户，欢迎您的光临。')


# # if判断测试
# print('欢迎来到儿童乐园，儿童免费，成人收费。')
# age = int(input("Enter your age: "))
# if age>=18:
#     print('您已成年，游玩需要补票10元。')
# else:
#     print('您未成年，可以免费入内。')
# print('祝您游玩愉快！')


# # if elif else测试
# height = int(input('请输入你的身高（cm):'))
# vip_level=int(input("请输入你的vip等级（1-5）："))
# day = int(input('请告诉我今天几号：'))
# if height < 120:
#     print('身高小于120cm,可以免费。')
# elif vip_level > 3:
#     print("vip级别大于3，可以免费。")
# elif day == 1:
#     print('今天是1号免费日，可以免费')
# else:
#     print("不好意思条件均不满足，需要买票10元。")
# print('祝您游玩愉快。')

#
# # if elif else测试  优化
# if int(input('请输入你的身高（cm):')) < 120:
#     print('身高小于120cm,可以免费。')
# elif int(input("请输入你的vip等级（1-5）：")) > 3:
#     print("vip级别大于3，可以免费。")
# elif int(input('请告诉我今天几号：')) == 1:
#     print("今天是1号免费日，可以免费。")
# else:
#     print("不好意思条件均不满足，需要买票10元。")
# print('祝您游玩愉快。')


# # 练习
# answer = 10
# if int(input('请输入第一次想菜的数字：')) == answer:
#     print("恭喜你，第一次就答对了！")
# elif int(input('不对，再猜一次：')) == answer:
#     print("恭喜你，第二次机会答对了！")
# elif int(input('不对，再猜最后一次：')) == answer:
#     print("恭喜你，最后一次机会答对了！")
# else:
#     print('sorry,全部猜错啦，答案是：%d'%answer)


# # 嵌套判断
# if int(input('你的身高是多少：'))>120:
#     print('身高超限，不可以免费。')
#     print('但是，vip大于三级可以免费。')
#     if int(input('你的vip级别是多少：'))>3:
#         print('恭喜你，vip级别达标，可以免费。')
#     else:
#         print('sorry，你需要补票，10元。')
# else:
#     print('欢迎你小朋友，可以免费游玩。')


# # 判断综合练习
# age =int(input('请输入你的年龄:'))
# # year = int(input('请输入你的入职时长:'))
# # level = int(input('请输入你的级别:'))
# if age >= 18:
#     print('你是成年人')
#     if age < 30:
#         print('你的年龄达标了')
#         if int(input('请输入你的入职时长:')) >2 :
#             print('恭喜你，年龄和入职时间都达标了，可以领取礼物')
#         elif int(input('请输入你的级别:')) >3:
#             print("恭喜你，年龄和级别达标，可以领取礼物")
#         else:
#             print('不好意思，您管年龄达标，但是入职时间和级别都不达标。')
#     else:
#         print("不好意思，年龄太大了")
# else:
#     print("不好意思，小朋友不可以领取。")


# # 嵌套练习
# import random
# from wsgiref.util import guess_scheme
#
# num = random.randint(1,10)
#
# guess_num = int(input('请输入你要猜测的数字：'))
# if guess_num == num:
#     print('恭喜你，第一次就猜中了')
# else:
#     if guess_num > num:
#         print('抱歉，你猜大了')
#     else:
#         print('抱歉，你猜小了')
#     guess_num = int(input('请再次输入你要猜测的数字：'))
#
#     if guess_num == num:
#         print('恭喜你，第二次猜中了')
#     else:
#         if guess_num > num:
#             print('你猜大了')
#         else:
#             print('你猜小了')
#
#         guess_num = int(input('请输入你要猜测的数字：'))
#
#         if guess_num == num:
#             print('恭喜你第三次猜中了')
#         else:
#             print('很遗憾，你一次都没猜中')


# # while测试
# i = 0
# while(i < 10):
#     print('财源广进，好运连连%d'%i)
#     i+=1


# # 1-100的和
# i = 0
# sum = 0
# while i < 100:
#     i +=1
#     sum += i
#
# print(f"1-100的和为:{sum}")


# # #while循环 猜数字
# import random
# num = random.randint(1, 100)
# count = 0
#
# # x = 0
# # while x != num:
# #     count += 1
# #     x = int(input("请输入你要猜测的数字:"))
# #     if x > num:
# #         print('猜大了')
# #     else:
# #         print('猜小了')
# # print('恭喜你猜对了！总共猜了%d次。' % count)
#
# # 另一种方法
# flag = True
# while flag:
#     guess_num = int(input("请输入猜测的数字: "))
#     count += 1
#     if guess_num == num:
#         print('猜中了')
#         flag = False
#     else:
#         if guess_num > num:
#             print('猜大了')
#         else:
#             print('猜小了')
# print(f'你总该猜了{count}次')


# # 九九乘法表
# i = 0
# while i != 9:
#     i +=1
#     j = 0
#     while j != i:
#         j +=1
#         print(f'{j}*{i}={i*j}\t',end='')
#     print('')
#
#
# i = 1
# while i <= 9:
#     j = 1; print(' '.join(f"{j}*{i}={i*j}\t" for j in range(1, i+1)))
#     i += 1


# # for 循环取字符串
# name = 'itheima is a brand of itcast'
# # str.count('字符')统计str中的‘字符’数量
# # print(f"有{name.count('a')}个a")
# count = 0
# for x in name:
#     if x == 'a':
#         count+=1
# print(f'有{count}个a')


# # range 语法
# # 语法1
# for x in range(10):
#     print(f"{x} ", end='')
# print()
# # 语法2
# for x in range(5,10):
#     print(f"{x} ", end='')
# print()
# # 语法3
# for x in range(5,20,5):
#     print(f"{x} ", end='')
# print()


# #range 练习
# num = int(input("Enter a number: "))
# count = 0
# for i in range(2,num,2):
#     print(i)
#     count += 1
# print(f"在1到{num}之间(不包含{num})有{count}个偶数")


# # for循环嵌套
# i = 0
# for i in range(1,101):
#     print(f'今天是第{i}天')
#     for j in range(1,11):
#         print(f"这是第次{j}检测")
# print(f'第{i}检测完成')


# # for循环九九乘法表
# for i in range(1,10):
#     for j in range(1,i+1):
#         print(f"{j}*{i}={i*j}\t",end='')
#     print('')


# # continue中断
# for i in range(1,6):
#     print('1111')
#     for j in range(1,6):
#         print('222')
#         continue
#         print('33')
#     print('444')


# # 发工资案例
# import random
# s = 10000
# for i in range(1,21):
#     if s <= 0:
#         print('工资发完了，下一个月领取吧')
#         break
#     num = random.randint(1, 10)
#     if num < 5:
#         print(f"员工{i},绩效{num},不发工资，下一位")
#     else:
#         s -=1000
#         print(f'向员工{i},发放工资，1000元，账户余额还剩余{s}')


# # def函数调用
# def sign(t):
#     if t <= 37.5:
#         print('体温正常，欢迎登录！')
#     else:
#         print('请注意休息。')
# sign(int(input("请输入你的体温：")))


# # 传参测试
# def add(x,y):
#     reslut = x + y
#     print(f'{x} + {y}的结果是：{reslut}')
# add(5,6)


# # 文档说明
# def add(x, y):
#     """
#     add函数可以接受两个参数，进行两数相加的功能
#     :param x:  表示相加的其中一个数字
#     :param y:  表示相加的另一个数字
#     :return:   返回值是两数相加的结果
#     """
#     result = x + y
#     print(f"两数相加的结果是：{result}")
#     return result
#
#
# add(5, 6)



# # 函数综合案例
# def check_balance():
#     print("----------查询余额----------")
#     print(f"{name},你好，你的账户当前余额为：{money}元")
#
# def save(num):
#
#     global money
#     print("----------存款----------")
#     money += num
#     print(f"{name},你好，您存款{num}元成功")
#     print(f"{name},你好，你的账户当前余额为：{money}元")
#
# def draw(num):
#     """
#     未补充取款金额上限
#     """
#     global money
#     money -= num
#     print("----------取款----------")
#     print(f"{name},你好，您取款{num}元成功")
#     print(f"{name},你好，你的账户当前余额为：{money}元")
#
# def menu():
#     print("----------主菜单----------")
#     print(f'{name},你好！欢迎来到梦幻银行。')
#     print('查询余额\t[输入1]')
#     print('存款\t\t[输入2]')
#     print('取款\t\t[输入3]')
#     print('退出\t\t[输入4]')
#     # go_on = True
#     while True:
#         num = int(input('输入您的选择：'))
#         if num == 1:
#             check_balance()
#             continue
#         elif num == 2:
#             save(int(input('已选择存款,请输入金额：')))
#             continue
#         elif num == 3:
#             draw(int(input('已选择取款,请输入金额：')))
#             continue
#         elif num == 4:
#             print('退出程序')
#             break
#         else:
#             print('输入错误，程序已退出')
#             break
#
#
# name = input("请输入你的姓名：")
# money = 5000000
# menu()


# mylist = [9,9,9,9,4,5,6]
# mylist2 =[1,0,1]
# mylist.append(8)
# mylist.insert(2,2)
# mylist[3] = 4
# mylist.extend(mylist2)
# num = mylist.pop(1)
# mylist.append(num)
# mylist.remove(0)
# count = mylist.count(9)
# len = len(mylist)
# print(mylist,num,count,len)
#
# mylist.clear()
# print(mylist)


# # 列表练习
# list = [21,25,21,23,22,20]
# list.append(31)
# list1 =[29,33,30]
# list.extend(list1)
# num = list.pop(0)
# num1 = list.pop(-1)
# num2 = list.index(31)
# print(list,num,num1,num2)


# # 列表遍历
# list = [1,2,3,4,5,6,7,8,9,10]
# def list_while_func():
#     index = 0
#     while index < len(list):
#         print(list[index])
#         index += 1
# def list_for_func():
#     for x in list:
#         print(x)
#
# list_while_func()
# list_for_func()
#
#
# # 列表遍历取奇数偶数
# list = [1,2,3,4,5,6,7,8,9,10]
# def list_while_func():
#     index = 0
#     while index < len(list):
#         if list[index] %2 == 0:
#             print(list[index])
#         index += 1
# def list_for_func():
#     for x in list:
#         if x %2 == 1:
#             print(x)
#
#
# list_while_func()
# list_for_func()


# # 分割字符串
# str = 'itheima itcast boxueg'
# count = str.count('it')
# new_str = str.replace(' ','|')
# print(count,new_str)
# list = new_str.split('|')
# print(list)


# # 字符串切片
# str = '123,员序程马黑来，none'
# print(str[-7:-12:-1])



# # 集合练习
# my_list = ['黑马程序员','纸船','黑马程序员','纸船','itheima','itcast','itcast']
# my_set = set()
# for item in my_list:
#     my_set.add(item)
# print(my_set)


# # 字典练习
# my_dictionary = {
#     '王丽红': {'部门':'科技部','工资':3000,'级别':1},
#     '周杰轮':{'部门':'市场部','工资':5000,'级别':2},
#     '林俊节':{'部门':'市场部','工资':7000,'级别':3},
#     '张学油':{'部门':'科技部','工资':4000,'级别':1},
#     '刘德滑':{'部门':'市场部','工资':6000,'级别':2},}
# for name in my_dictionary:
#     if my_dictionary[name]['级别'] == 1:
#         my_dictionary1 = my_dictionary[name]
#         my_dictionary1['级别'] = 2
#         my_dictionary1['工资'] +=1000
#         my_dictionary[name]=my_dictionary1
#
# print(my_dictionary)



# # 多返回值
# def test():
#     return 1,'dusk',True
# x,y,z = test()
# print(x,y,z)

#
# # 传参的多种形式
# def test(name,age,gender):
#     print(f'{name},{age},{gender}')
# test('dusk',18,'男')
# test(name='lin',age=21,gender='女')
# test('汐',age=21,gender='女')


# 文件读取练习
# 方法一
# f = open("E:/PyProject/word.txt","r",encoding = 'utf-8')
# w = f.read()
# count = w.count('itheima')
# print(count)
# 方法二
# with open('E:/PyProject/word.txt','r',encoding = 'utf-8') as f:
#     print(f.read().count('itheima'))
#     f.close()
# 方法三
# count = 0
# for line in f:
#     line = line.strip()
#     words = line.split(' ')
#     for word in words:
#         if word == "itheima":
#             count += 1
# print(count)
# # 关闭文件
# f.close()


# # 写入练习
# f = open("E:/PyProject/test.txt","w",encoding = 'utf-8')
# f.write("hello world!!!")
# # f.flush()
# f.close()



# 导入包测试
# import my_package.my_module1
# import my_package.my_module2
#
# my_package.my_module1.info_print1()
# my_package.my_module2.info_print2()

# from my_package import my_module1
# from my_package import my_module2
#
# my_module1.info_print1()
# my_module2.info_print2()

# from my_package.my_module1 import info_print1
# from my_package.my_module2 import info_print2
#
# info_print1()
# info_print2()
#
# from my_package import *
# my_module1.info_print1()
# my_module2.info_print2()



# # 文件、包、模块综合练习 配合my_utils完成
# from my_utils import *
# str1 = 'asdfghjkl'
# str2 = str_util.str_reverse(str1)
# str3 = str_util.substr(str_util.str_reverse(str1),1,5)
# print(str2,'\n',str3)